home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / include / libraries / configregs.h < prev    next >
C/C++ Source or Header  |  1996-09-10  |  10KB  |  283 lines

  1. #ifndef LIBRARIES_CONFIGREGS_H
  2. #define LIBRARIES_CONFIGREGS_H 1
  3. /*
  4. ** configregs.h for ACE Basic
  5. **
  6. ** Note: Translated to ACE by ConvertC2ACE
  7. **       @ MapMeadow Software, Nils Sjoholm
  8. **
  9. **
  10. ** Date: 09/01/95
  11. **
  12. **
  13. */
  14.  
  15. /*
  16. ** This are the StructPointer defines for configregs.h
  17. */
  18. #ifndef DiagAreaPtr
  19. #define DiagAreaPtr ADDRESS
  20. #endif
  21. #ifndef ExpansionControlPtr
  22. #define ExpansionControlPtr ADDRESS
  23. #endif
  24. #ifndef ExpansionRomPtr
  25. #define ExpansionRomPtr ADDRESS
  26. #endif
  27. /*
  28. ** End of StructPointer defines for configregs.h
  29. */
  30.  
  31.  
  32.  
  33.  
  34. #ifndef EXEC_TYPES_H
  35. #include <exec/types.h>
  36. #endif  /* EXEC_TYPES_H */
  37.  
  38.  
  39. /*
  40. ** AutoConfig (tm) boards each contain a 32 byte "ExpansionRom" area that is
  41. ** read by the system software at configuration time.  Configuration of each
  42. ** board starts when the ConfigIn* signal is passed from the previous board
  43. ** (or from the system for the first board).  Each board will present it's
  44. ** ExpansionRom structure at location $00E80000 to be read by the system.
  45. ** This file defines the appearance of the ExpansionRom area.
  46. **
  47. ** Expansion boards are actually organized such that only one nybble per
  48. ** 16 bit SHORTINT contains valid information.  The low nybbles of each
  49. ** SHORTINT are combined to fill the structure below. (This table is structured
  50. ** as LOGICAL information.  This means that it never corresponds exactly
  51. ** with a physical implementation.)
  52. **
  53. ** The ExpansionRom space is further split into two regions:  The first 16
  54. ** bytes are read-only.  Except for the er_type field,  this area is inverted
  55. ** by the system software when read in.  The second 16 bytes contain the
  56. ** control portion,  where all read/write registers are located.
  57. **
  58. ** The system builds one "ConfigDev" structure for each board found.  The
  59. ** list of boards can be examined using the expansion.library/FindConfigDev
  60. ** function.
  61. **
  62. ** A special "hacker" Manufacturer ID number is reserved for test use:
  63. ** 2011 ($7DB).  When inverted this will look like $F824.
  64. */
  65.  
  66. STRUCT ExpansionRom         /* -First 16 bytes of the expansion ROM */
  67.     BYTE    er_Type     /* Board type,  size and flags */
  68.     BYTE    er_Product  /* Product number,  assigned by manufacturer */
  69.     BYTE    er_Flags    /* Flags */
  70.     BYTE    er_Reserved03   /* Must be zero ($ff inverted) */
  71.     SHORTINT   er_Manufacturer  /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */
  72.     LONGINT   er_SerialNumber  /* Available for use by manufacturer */
  73.     SHORTINT   er_InitDiagVec  /* Offset to optional "DiagArea" structure */
  74.     BYTE    er_Reserved0c 
  75.     BYTE    er_Reserved0d 
  76.     BYTE    er_Reserved0e 
  77.     BYTE    er_Reserved0f 
  78. END STRUCT 
  79.  
  80.  
  81. /*
  82. ** Note that use of the ec_BaseAddress register is tricky.  The system
  83. ** will actually write twice.  First the low order nybble is written
  84. ** to the ec_BaseAddress register+2 (D15-D12).  Then the entire byte is
  85. ** written to ec_BaseAddress (D15-D8).  This allows writing of a byte-wide
  86. ** address to nybble size registers.
  87. */
  88.  
  89. STRUCT ExpansionControl     /* -Second 16 bytes of the expansion ROM */
  90.     BYTE    ec_Interrupt    /* Optional interrupt control register */
  91.     BYTE    ec_Z3_HighBase  /* Zorro III   : Config address bits 24-31 */
  92.     BYTE    ec_BaseAddress  /* Zorro II/III: Config address bits 16-23 */
  93.     BYTE    ec_Shutup   /* The system writes here to shut up a board */
  94.     BYTE    ec_Reserved14 
  95.     BYTE    ec_Reserved15 
  96.     BYTE    ec_Reserved16 
  97.     BYTE    ec_Reserved17 
  98.     BYTE    ec_Reserved18 
  99.     BYTE    ec_Reserved19 
  100.     BYTE    ec_Reserved1a 
  101.     BYTE    ec_Reserved1b 
  102.     BYTE    ec_Reserved1c 
  103.     BYTE    ec_Reserved1d 
  104.     BYTE    ec_Reserved1e 
  105.     BYTE    ec_Reserved1f 
  106. END STRUCT 
  107.  
  108. /*
  109. ** many of the constants below consist of a triplet of equivalent
  110. ** definitions: xxMASK is a bit mask of those bits that matter.
  111. ** xxBIT is the starting bit number of the field.  xxSIZE is the
  112. ** number of bits that make up the definition.  This method is
  113. ** used when the field is larger than one bit.
  114. **
  115. ** If the field is only one bit wide then the xxB_xx and xxF_xx convention
  116. ** is used (xxB_xx is the bit number,  and xxF_xx is mask of the bit).
  117. */
  118.  
  119. /* manifest constants */
  120. #define E_SLOTSIZE      &H10000
  121. #define E_SLOTMASK      &Hffff
  122. #define E_SLOTSHIFT     16
  123.  
  124. /* these define the free regions of Zorro memory space.
  125. ** THESE MAY WELL CHANGE FOR FUTURE PRODUCTS!
  126. */
  127. #define E_EXPANSIONBASE &H00e80000  /* Zorro II  config address */
  128. #define EZ3_EXPANSIONBASE   &Hff000000  /* Zorro III config address */
  129.  
  130. #define E_EXPANSIONSIZE &H00080000  /* Zorro II  I/O type cards */
  131. #define E_EXPANSIONSLOTS    8
  132.  
  133. #define E_MEMORYBASE        &H00200000  /* Zorro II  8MB space */
  134. #define E_MEMORYSIZE        &H00800000
  135. #define E_MEMORYSLOTS       128
  136.  
  137. #define EZ3_CONFIGAREA      &H40000000  /* Zorro III space */
  138. #define EZ3_CONFIGAREAEND   &H7FFFFFFF  /* Zorro III space */
  139. #define EZ3_SIZEGRANULARITY &H00080000  /* 512K increments */
  140.  
  141.  
  142.  
  143. /**** er_Type definitions (ttldcmmm) ***************************************/
  144.  
  145. /* er_Type board type bits -- the OS ignores "old style" boards */
  146. #define ERT_TYPEMASK        &Hc0    /* Bits 7-6 */
  147. #define ERT_TYPEBIT     6
  148. #define ERT_TYPESIZE        2
  149. #define ERT_NEWBOARD        &Hc0
  150. #define ERT_ZORROII     ERT_NEWBOARD
  151. #define ERT_ZORROIII        &H80
  152.  
  153. /* other bits defined in er_Type */
  154. #define ERTB_MEMLIST        5   /* Link RAM into free memory list */
  155. #define ERTB_DIAGVALID      4   /* ROM vector is valid */
  156. #define ERTB_CHAINEDCONFIG  3   /* Next config is part of the same card */
  157.  
  158. #define ERTF_MEMLIST        (32)
  159. #define ERTF_DIAGVALID      (16)
  160. #define ERTF_CHAINEDCONFIG  (8)
  161.  
  162. /* er_Type field memory size bits */
  163. #define ERT_MEMMASK     &H07    /* Bits 2-0 */
  164. #define ERT_MEMBIT      0
  165. #define ERT_MEMSIZE     3
  166.  
  167.  
  168.  
  169. /**** er_Flags byte -- for those things that didn't fit into the type byte ****/
  170. /**** the hardware stores this byte in inverted form               ****/
  171. #define ERFF_MEMSPACE       (128)  /* Wants to be in 8 meg space. */
  172. #define ERFB_MEMSPACE       7   /* (NOT IMPLEMENTED) */
  173.  
  174. #define ERFF_NOSHUTUP       (64)  /* Board can't be shut up */
  175. #define ERFB_NOSHUTUP       6
  176.  
  177. #define ERFF_EXTENDED       (32)  /* Zorro III: Use extended size table */
  178. #define ERFB_EXTENDED       5   /*        for bits 0-2 of er_Type */
  179.                     /* Zorro II : Must be 0 */
  180.  
  181. #define ERFF_ZORRO_III      (16)  /* Zorro III: must be 1 */
  182. #define ERFB_ZORRO_III      4   /* Zorro II : must be 0 */
  183.  
  184. #define ERT_Z3_SSMASK       &H0F    /* Bits 3-0.  Zorro III Sub-Size.  How */
  185. #define ERT_Z3_SSBIT        0   /* much space the card actually uses   */
  186. #define ERT_Z3_SSSIZE       4   /* (regardless of config granularity)  */
  187.                     /* Zorro II : must be 0        */
  188.  
  189.  
  190. /* ec_Interrupt register (unused) ********************************************/
  191. #define ECIB_INTENA     1
  192. #define ECIB_RESET      3
  193. #define ECIB_INT2PEND       4
  194. #define ECIB_INT6PEND       5
  195. #define ECIB_INT7PEND       6
  196. #define ECIB_INTERRUPTING   7
  197.  
  198. #define ECIF_INTENA     (2)
  199. #define ECIF_RESET      (8)
  200. #define ECIF_INT2PEND       (16)
  201. #define ECIF_INT6PEND       (32)
  202. #define ECIF_INT7PEND       (64)
  203. #define ECIF_INTERRUPTING   (128)
  204.  
  205.  
  206.  
  207. /***************************************************************************
  208. **
  209. ** these are the specifications for the diagnostic area.  If the Diagnostic
  210. ** Address Valid bit is set in the Board Type byte (the first byte in
  211. ** expansion space) then the Diag Init vector contains a valid offset.
  212. **
  213. ** The Diag Init vector is actually a SHORTINT offset from the base of the
  214. ** board.  The resulting address points to the base of the DiagArea
  215. ** structure.  The structure may be physically implemented either four, 
  216. ** eight,  or sixteen bits wide.  The code will be copied out into
  217. ** ram first before being called.
  218. **
  219. ** The da_Size field,  and both code offsets (da_DiagPoint and da_BootPoint)
  220. ** are offsets from the diag area AFTER it has been copied into ram,  and
  221. ** "de-nibbleized" (if needed).  (In other words,  the size is the size of
  222. ** the actual information,  not how much address space is required to
  223. ** store it.)
  224. **
  225. ** All bits are encoded with uninverted logic (e.g. 5 volts on the bus
  226. ** is a logic one).
  227. **
  228. ** If your board is to make use of the boot facility then it must leave
  229. ** its config area available even after it has been configured.  Your
  230. ** boot vector will be called AFTER your board's final address has been
  231. ** set.
  232. **
  233. ****************************************************************************/
  234.  
  235. STRUCT DiagArea  
  236.     BYTE    da_Config   /* see below for definitions */
  237.     BYTE    da_Flags    /* see below for definitions */
  238.     SHORTINT   da_Size     /* the size (in bytes) of the total diag area */
  239.     SHORTINT   da_DiagPoint    /* where to start for diagnostics,  or zero */
  240.     SHORTINT   da_BootPoint    /* where to start for booting */
  241.     SHORTINT   da_Name     /* offset in diag area where a string */
  242.                 /*   identifier can be found (or zero if no */
  243.                 /*   identifier is present). */
  244.  
  245.     SHORTINT   da_Reserved01   /* two words of reserved data.  must be zero. */
  246.     SHORTINT   da_Reserved02 
  247. END STRUCT 
  248.  
  249. /* da_Config definitions */
  250. /*
  251. ** DAC_BYTEWIDE can be simulated using DAC_NIBBLEWIDE.
  252. */
  253. #define DAC_BUSWIDTH    &HC0 /* two bits for bus width */
  254. #define DAC_NIBBLEWIDE  &H00
  255. #define DAC_BYTEWIDE    &H40 /* BUG: Will not work under V34 Kickstart! */
  256. #define DAC_WORDWIDE    &H80
  257.  
  258. #define DAC_BOOTTIME    &H30    /* two bits for when to boot */
  259. #define DAC_NEVER   &H00    /* obvious */
  260. #define DAC_CONFIGTIME  &H10    /* call da_BootPoint when first configing */
  261.                 /*   the device */
  262. #define DAC_BINDTIME    &H20    /* run when binding drivers to boards */
  263.  
  264. /*
  265. **
  266. ** These are the calling conventions for the diagnostic callback
  267. ** (from da_DiagPoint):
  268. **
  269. ** A7 -- points to at least 2K of stack
  270. ** A6 -- ExecBase
  271. ** A5 -- ExpansionBase
  272. ** A3 -- your board's ConfigDev structure
  273. ** A2 -- Base of diag/init area that was copied
  274. ** A0 -- Base of your board
  275. **
  276. ** Your board must return a value in D0.  If this value is NULL,  then
  277. ** the diag/init area that was copied in will be returned to the free
  278. ** memory pool.
  279. */
  280.  
  281.  
  282. #endif /* LIBRARIES_CONFIGREGS_H */
  283.